﻿#ifndef COMMONCONST_H
#define COMMONCONST_H
#include <QString>
#include <QStringList>
#include <QDateTime>
#include <QObject>
#include <QFont>
//#include <WinUser.h>
#define IN//输入参数标记
#define OUT//输出参数标记
#define IN_OUT//输入输出参数标记
#define USE_SIGNAL_DECOMPRESSION_WAY
#define OPTIMIZATION_ALGORITHM
#define MODIFY_CAPTURE_TIME//调试采集时间, added by qinyaning 202101111008
#define USE_CUSTOMIZE_TIP_DLG
//--motor RPM params names
const QString MOTOR_RPM_NAME = "Motor_Rpm";
const QString MOTOR_X_RPM_NAME = "Motor_X_Rpm";
const QString MOTOR_Y_RPM_NAME = "Motor_Y_Rpm";
const QString MOTOR_Z_RPM_NAME = "Motor_Z_Rpm";
const QString MOTOR_E_RPM_NAME = "Motor_E_Rpm";
const QString MOTOR_G_RPM_NAME = "Motor_G_Rpm";
const QString MOTOR_Q_RPM_NAME = "Motor_Q_Rpm";
//--
//--设备参数表sql语句
//--创建表语句
const QString SPECTMETER_PARAM_TABLE = "Spectmeter_params";
const QString CREATE_SPECTMETER_PARAM_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `Spectmeter_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`c0` DOUBLE default NULL,"
        "`c1` DOUBLE default NULL,"
        "`c2` DOUBLE default NULL,"
        "`c3` DOUBLE default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
const QString EYE_MOTOR_PARAM_TABLE = "Eye_motor_params";
const QString CREATE_EYE_MOTOR_PARAM_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `Eye_motor_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`eyeFlag` TINYINT NOT NULL,"
        "`motorX` FLOAT default NULL,"
        "`motorY` FLOAT default NULL,"
        "`motorZ` FLOAT default NULL,"
        "`motorE` FLOAT default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
const QString DEFAULT_MODE_PARAM_TABLE = "Default_mode_params";
const QString CREATE_DEFAULT_MODE_PARAM_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `Default_mode_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`alignment_Percision` FLOAT default NULL,"
        "`sld_Leavel` SMALLINT default NULL,"
        "`enface_RowBegin` SMALLINT default NULL,"
        "`enface_RowEnd` SMALLINT default NULL,"
        "`motor_step` FLOAT default NULL,"
        "`bscan_Qulity_Scale` FLOAT default NULL,"
        "`optical_range` SMALLINT default NULL,"
        "`second_ref_pos` FLOAT default NULL,"
        "`refaction_init_deg` SMALLINT default NULL,"
        "`second_ref_deg` SMALLINT default NULL,"
        "`MOTOR_X_MAX` FLOAT default NULL,"
        "`MOTOR_Y_MAX` FLOAT default NULL,"
        "`MOTOR_Z_MAX` FLOAT default NULL,"
        "`MOTOR_E_MAX` FLOAT default NULL,"
        "`MOTOR_G_MAX` FLOAT default NULL,"
        "`MOTOR_Q_MAX` FLOAT default NULL,"
        "`optical_init_pos` FLOAT default NULL,"
        "`packPosX` FLOAT default NULL,"
        "`packPosY` FLOAT default NULL,"
        "`packPosZ` FLOAT default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
const QString SCAN_PARAMS_TABLE = "Scan_params";
const QString CREATE_SCAN_PARAMS_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `Scan_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`scan_way` VARCHAR(64) default NULL,"
        "`Axis_Fast_End` FLOAT default NULL,"
        "`Axis_Fast_Start` FLOAT default NULL,"
        "`Axis_Slow_End` FLOAT default NULL,"
        "`Axis_Slow_Start` FLOAT default NULL,"
        "`SignalTrigger` SMALLINT default NULL,"
        "`ScanDirection` TINYINT default NULL,"
        "`Cycle` FLOAT default NULL,"
        "`Voltage` FLOAT default NULL,"
        "`Exposure` SMALLINT default NULL,"
        "`Line_Period` FLOAT default NULL,"
        "`Gain` SMALLINT default NULL,"
        "`Preamp_Gain` SMALLINT default NULL,"
        "`Capture_Number` SMALLINT default NULL,"
        "`Frame_Trigger_Number` SMALLINT default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
const QString LCD_TARGET_CENTER_PARAM_TABLE = "LCD_target_center_params";
const QString CREATE_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `LCD_target_center_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`Default_PosX` FLOAT default NULL,"
        "`Default_PosY` FLOAT default NULL,"
        "`Glaucoma_Left_PosX` FLOAT default NULL,"
        "`Glaucoma_Left_PosY` FLOAT default NULL,"
        "`Glaucoma_Right_PosX` FLOAT default NULL,"
        "`Glaucoma_Right_PosY` FLOAT default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
const QString FRONT_MODE_MOTOR_PARAM_TABLE = "Front_mode_motor_params";
const QString CREATE_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS `Front_mode_motor_params`"
        "(`id` INTEGER NOT NULL AUTO_INCREMENT,"
        "`motorQ_Front` FLOAT default NULL,"
        "`motorG_Front` FLOAT default NULL,"
        "`motorX_Front` FLOAT default NULL,"
        "PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;";

const QStringList CREATE_TABLE_STATEMENTS = { CREATE_SPECTMETER_PARAM_TABLE_STATEMENT,
                                            CREATE_EYE_MOTOR_PARAM_TABLE_STATEMENT,
                                            CREATE_DEFAULT_MODE_PARAM_TABLE_STATEMENT,
                                            CREATE_SCAN_PARAMS_TABLE_STATEMENT,
                                            CREATE_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT,
                                            CREATE_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT };
//--查询表语句
const QString SELECT_SPECTMETER_PARAM_TABLE_STATEMENT = "select * from `Spectmeter_params`;";
const QString SELECT_EYE_MOTOR_PARAM_TABLE_STATEMENT = "select * from `Eye_motor_params`;";
const QString SELECT_DEFAULT_MODE_PARAM_TABLE_STATEMENT = "select * from `Default_mode_params`;";
const QString SELECT_SCAN_PARAMS_TABLE_STATEMENT = "select * from `Scan_params`;";
const QString SELECT_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT = "select * from `LCD_target_center_params`;";
const QString SELECT_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT = "select * from `Front_mode_motor_params`;";
const QString SELECT_ADMIN_ACCOUNT_COUNT = "select count(*) from %1.%2 "
                                           "where username = 'admin' and role = 'admin';";
const QStringList SELECT_TABLE_STATEMENTS = { SELECT_SPECTMETER_PARAM_TABLE_STATEMENT,
                                           SELECT_EYE_MOTOR_PARAM_TABLE_STATEMENT,
                                           SELECT_DEFAULT_MODE_PARAM_TABLE_STATEMENT,
                                           SELECT_SCAN_PARAMS_TABLE_STATEMENT,
                                           SELECT_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT,
                                           SELECT_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT };
//--删除表语句
const QString DROP_SPECTMETER_PARAM_TABLE_STATEMENT = "DROP TABLE IF EXISTS `Spectmeter_params`;";
const QString DROP_EYE_MOTOR_PARAM_TABLE_STATEMENT = "DROP TABLE IF EXISTS `Eye_motor_params`;";
const QString DROP_DEFAULT_MODE_PARAM_TABLE_STATEMENT = "DROP TABLE IF EXISTS `Default_mode_params`;";
const QString DROP_SCAN_PARAMS_TABLE_STATEMENT = "DROP TABLE IF EXISTS `Scan_params`;";
const QString DROP_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT = "DROP TABLE IF EXISTS `LCD_target_center_params`;";
const QString DROP_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT = "DROP TABLE IF EXISTS `Front_mode_motor_params`;";

const QStringList DROP_TABLES_STATEMENT = { DROP_SPECTMETER_PARAM_TABLE_STATEMENT,
                                          DROP_EYE_MOTOR_PARAM_TABLE_STATEMENT,
                                          DROP_DEFAULT_MODE_PARAM_TABLE_STATEMENT,
                                          DROP_SCAN_PARAMS_TABLE_STATEMENT,
                                          DROP_LCD_TARGET_CENTER_PARAM_TABLE_STATEMENT,
                                          DROP_FRONT_MODE_MOTOR_PARAM_TABLE_STATEMENT };

const QString SELECT_COLUMN_COUNT_IN_TABLE = "select count(*) from information_schema.columns "
                                             "where table_name = '%1' and column_name = '%2' and TABLE_SCHEMA='%3';";
const QString CREATE_COLUMN_IN_TABLE = "ALTER TABLE %1.%2 ADD COLUMN `%3` %4 %5 ;";


//--

const QString PYTHON_EXE_NAME = "Python.exe";
const QString ALGORITHM_EXE_NAME = "algorithm.exe";
//const QString DENOISE_EXE_NAME = "DenoiseImg";

//-------------------------------
//--日志参数
const QString BV1000_DUMP_DIR = "BV1000Dmps";

//--
const QString AREA_AXIS_FAST_VER_END_KEY = "Axis_Fast_Ver_End";
const QString AREA_AXIS_FAST_VER_START_KEY = "Axis_Fast_Ver_Start";
const QString AREA_AXIS_SLOW_VER_END_KEY = "Axis_Slow_Ver_End";
const QString AREA_AXIS_SLOW_VER_START_KEY = "Axis_Slow_Ver_Start";


//--系统参数单位, 需支持多语言
const QString SPECTMETER_UINT = "(nm)";//纳米
const QString MOTOR_POS_UINT = "(mm)";//毫米
const QString DEG_UINT = "(Degree)";//度
const QString VOL_UINT = "(V)";//伏特
const QString MILLISECOND = "(ms)";//毫秒
//--眼前节参数
const QString EYE_FRONT_MOTOR_X_MAX_KEY = "motorX_Front_Max";

//--
constexpr double FLOAT_ACCURACY_ERROR = 0.001;


const QString ADMIN_ROLE = "admin";

constexpr int TELEPHONE_NUM_LEN = 11;

const QString SCAN_MODE_EYE_SCAN_ORDER = "scan_Mode_Eye_Scan_Order";//值为0是先扫右眼后扫左眼, 值为1是先扫左眼后扫右眼

const QFont COMMON_FONT("Microsoft Yahei", 19);
const QString CAM_CMOS_OCT_LOG_FILE_NAME = "GenTlCamCmosOctUsb3Debug.txt";
const QString DEFAULT_STORE_DATA_PATH = "C:/BV1000Data";
const QString DEFAULT_EXPORT_DATA_PATH = "C:/BV1000Export";
const QString DEFAULT_RESTORE_DIR = "C:";


#endif // COMMONCONST_H
